package com.ah.shanxi_demo.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zt 2020/8/19
 */
public enum PolicyGuidTypeEnum implements PolicyCommonInterface {


    //启用编码类型
    GUID_TYPE_0("0", "不启用"),
    GUID_TYPE_1("1", "设备编码"),
    GUID_TYPE_2("2", "信息系统编码"),
    ;

    private String key;
    private String value;

    final static Map<String, PolicyGuidTypeEnum> cacheGuid = new HashMap<>(values().length);

    static {
        for (PolicyGuidTypeEnum policyGuidTypeEnum : values()) {
            cacheGuid.put(policyGuidTypeEnum.key, policyGuidTypeEnum);
        }
    }

    PolicyGuidTypeEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static PolicyGuidTypeEnum convert(String key) {
        PolicyGuidTypeEnum type = cacheGuid.get(key);
        return type;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    public Integer getKeyInt() {
        return Integer.parseInt(key);
    }
}
